﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Rename.UC.FastOLSV;
namespace Rename.UC.组合
{
    public partial class Uc中间列表 : UserControl
    {
        public Uc中间列表()
        {
            InitializeComponent();
        }
        public Uc中间列表(OLSVType olsvType)
        {
            InitializeComponent1(olsvType);
            this.cmbFilterType.SelectedIndex = 1;
            this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged);    
        }

        public UcFastOlsvBase UcFastOLSV
        {
            get => ucFastOlsv;
        }
        #region 自定义事件
        private EventHandler<EventArgs> _clearLsvHandler = null;
        public event EventHandler<EventArgs> ClearListViewItem
        {
            add { _clearLsvHandler += value; }
            remove { _clearLsvHandler -= value; }
        }

        protected void OnClearListViewItem(EventArgs e)
        {
            var temp = System.Threading.Volatile.Read(ref _clearLsvHandler);
            if (temp != null)
            {
                temp(this, e);
            }
        }
        #endregion
        private void ucFastOlsv_Load(object sender, EventArgs e)
        {

        }

        private void UcListView清空列表_Load(object sender, EventArgs e)
        {
            //ucLsv.AddDefaultColumns();
        }

        private void ucBtn清空列表_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK == MessageBox.Show("是否清除列表", "李华丽批量重命名软件", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
            {
                ucFastOlsv.Clear();
            }
        }

        private void ucBtn清空列表_MouseEnter(object sender, EventArgs e)
        {
            this.ucBtn清空列表.Image = global::Rename.Properties.Resources.清空列表22;
            this.ucBtn清空列表.ForeColor = Color.Black;
        }

        private void ucBtn清空列表_MouseLeave(object sender, EventArgs e)
        {
            this.ucBtn清空列表.Image = global::Rename.Properties.Resources.清空列表11;
            this.ucBtn清空列表.ForeColor = System.Drawing.SystemColors.ControlDark;
        }

        private void txtFilter_TextChanged(object sender, EventArgs e)
        {
            this.ucFastOlsv.Filter(txtFilter.Text.Trim(), cmbFilterType.Text.Trim());
        }
    }
}
